package com.chb.demo.service;

import com.chb.demo.dao.PerformanceDao;
import com.chb.demo.entity.Performance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

@Service
public class PerformanceService {
    @Autowired
    PerformanceDao performanceDao;

    public Page<Performance> findAllPerformance(int pageNo, int pageSize) {
        PageRequest pageRequest = PageRequest.of((pageNo - 1) * pageSize, pageSize);
        System.out.println(pageRequest.toString());
        return  performanceDao.findAll(pageRequest);
    }
}
